Produced by Araxis Merge on 2021-05-13 09:08:40 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Megamenu/Helper | Data.php | 2018-03-29 22:54:44 +0000 |
| 2 | /Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Megamenu/Helper | Data.php | 2020-06-10 07:45:42 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 7 | 210 |
| Changed | 6 | 12 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | /** | 2 | /** | |||
| 3 | * Copyright © 2018 Porto. All rights reserved. | 3 | * Copyright © 2018 Porto. All rights reserved. | |||
| 4 | */ | 4 | */ | |||
| 5 | namespace Smartwave\Megamenu\Helper; | 5 | namespace Smartwave\Megamenu\Helper; | |||
| 6 | 6 | |||||
| 7 | use Magento\Framework\View\Result\PageFactory; | 7 | use Magento\Framework\View\Result\PageFactory; | |||
| 8 | 8 | |||||
| 9 | class Data extends \Magento\Framework\App\Helper\AbstractHelper | 9 | class Data extends \Magento\Framework\App\Helper\AbstractHelper | |||
| 10 | { | 10 | { | |||
| 11 | 11 | |||||
| 12 | protected $_objectManager; | 12 | protected $_objectManager; | |||
| 13 | protected $_categoryHelper; | 13 | protected $_categoryHelper; | |||
| 14 | protected $_categoryFactory; | 14 | protected $_categoryFactory; | |||
| 15 | protected $_categoryFlatConfig; | 15 | protected $_categoryFlatConfig; | |||
| 16 | protected $_filterProvider; | 16 | protected $_filterProvider; | |||
| 17 | protected $resultPageFactory; | 17 | protected $resultPageFactory; | |||
| 18 | 18 | |||||
| 19 | public function __construct( | 19 | public function __construct( | |||
| 20 | \Magento\Framework\App\Helper\Context $context, | 20 | \Magento\Framework\App\Helper\Context $context, | |||
| 21 | \Magento\Catalog\Helper\Category $categoryHelper, | 21 | \Magento\Catalog\Helper\Category $categoryHelper, | |||
| 22 | \Magento\Catalog\Model\CategoryFactory $categoryFactory, | 22 | \Magento\Catalog\Model\CategoryFactory $categoryFactory, | |||
| 23 | \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, | 23 | \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, | |||
| 24 | \Magento\Framework\ObjectManagerInterface $objectManager, | 24 | \Magento\Framework\ObjectManagerInterface $objectManager, | |||
| 25 | \Magento\Cms\Model\Template\FilterProvider $filterProvider, | 25 | \Magento\Cms\Model\Template\FilterProvider $filterProvider, | |||
| 26 | PageFactory $resultPageFactory, | 26 | PageFactory $resultPageFactory, | |||
| 27 | \Magento\Store\Model\StoreManagerInterface $storeManager | 27 | \Magento\Store\Model\StoreManagerInterface $storeManager | |||
| 28 | ) { | 28 | ) { | |||
| 29 | $this->_storeManager = $storeManager; | 29 | $this->_storeManager = $storeManager; | |||
| 30 | $this->_objectManager= $objectManager; | 30 | $this->_objectManager= $objectManager; | |||
| 31 | $this->_categoryFactory = $categoryFactory; | 31 | $this->_categoryFactory = $categoryFactory; | |||
| 32 | $this->_categoryFlatConfig = $categoryFlatState; | 32 | $this->_categoryFlatConfig = $categoryFlatState; | |||
| 33 | $this->_categoryHelper = $categoryHelper; | 33 | $this->_categoryHelper = $categoryHelper; | |||
| 34 | $this->resultPageFactory = $resultPageFactory; | 34 | $this->resultPageFactory = $resultPageFactory; | |||
| 35 | $this->_filterProvider = $filterProvider; | 35 | $this->_filterProvider = $filterProvider; | |||
| 36 | 36 | |||||
| 37 | parent::__construct($context); | 37 | parent::__construct($context); | |||
| 38 | } | 38 | } | |||
| 39 | public function getBaseUrl($url_type=\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) | 39 | public function getBaseUrl($url_type=\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) | |||
| 40 | { | 40 | { | |||
| 41 | return $this->_storeManager->getStore()->getBaseUrl($url_type); | 41 | return $this->_storeManager->getStore()->getBaseUrl( | |||
| 42 | } | 42 | } | |||
| 43 | public function getConfig($config_path) | 43 | public function getConfig($config_path) | |||
| 44 | { | 44 | { | |||
| 45 | return $this->scopeConfig->getValue( | 45 | return $this->scopeConfig->getValue( | |||
| 46 | $config_path, | 46 | $config_path, | |||
| 47 | \Magento\Store\Model\ScopeInterface::SCOPE_STORE | 47 | \Magento\Store\Model\ScopeInterface::SCOPE_STORE | |||
| 48 | ); | 48 | ); | |||
| 49 | } | 49 | } | |||
| 50 | public function getModel($model) { | 50 | public function getModel($model) { | |||
| 51 | return $this->_objectManager->create($model); | 51 | return $this->_objectManager->create($model); | |||
| 52 | } | 52 | } | |||
| 53 | public function getCurrentStore() { | 53 | public function getCurrentStore() { | |||
| 54 | return $this->_storeManager->getStore(); | 54 | return $this->_storeManager->getStore(); | |||
| 55 | } | 55 | } | |||
| 56 | public function getFirstLevelCategories($sorted = false, $asCollection = false, $toLoad = true) { | 56 | public function getFirstLevelCategories($sorted = false, $asCollection = false, $toLoad = true) { | |||
| 57 | return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); | 57 | return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); | |||
| 58 | } | 58 | } | |||
| 59 | public function getCategoryModel($id) | 59 | public function getCategoryModel($id) | |||
| 60 | { | 60 | { | |||
| 61 | $_category = $this->_categoryFactory->create(); | 61 | $_category = $this->_categoryFactory->create(); | |||
| 62 | $_category->load($id); | 62 | $_category->load($id); | |||
| 63 | 63 | |||||
| 64 | return $_category; | 64 | return $_category; | |||
| 65 | } | 65 | } | |||
| 66 | public function getActiveChildCategories($category) | 66 | public function getActiveChildCategories($category) | |||
| 67 | { | 67 | { | |||
| 68 | $children = []; | 68 | $children = []; | |||
| 69 | $subcategories = $category->getChildrenCategories(); | 69 | $subcategories = $category->getChildrenCategories(); | |||
| 70 | foreach($subcategories as $category) { | 70 | foreach($subcategories as $category) { | |||
| 71 | if (!$category->getIsActive()) { | 71 | if (!$category->getIsActive()) { | |||
| 72 | continue; | 72 | continue; | |||
| 73 | } | 73 | } | |||
| 74 | $children[] = $category; | 74 | $children[] = $category; | |||
| 75 | } | 75 | } | |||
| 76 | return $children; | 76 | return $children; | |||
| 77 | } | 77 | } | |||
| 78 | public function getBlockContent($content = '') { | 78 | public function getBlockContent($content = '') { | |||
| 79 | if(!$this->_filterProvider) | 79 | if(!$this->_filterProvider) | |||
| 80 | return $content; | 80 | return $content; | |||
| 81 | return $this->_filterProvider->getBlockFilter()->filter(trim($content)); | 81 | return $this->_filterProvider->getBlockFilter()->filter(trim($content)); | |||
| 82 | } | 82 | } | |||
| 83 | public function getResultPageFactory() { | 83 | public function getResultPageFactory() { | |||
| 84 | return $this->resultPageFactory; | 84 | return $this->resultPageFactory; | |||
| 85 | } | 85 | } | |||
| 86 | public function getSubmenuItemsHtml($children, $level=0, $max_level=2) | 86 | public function getSubmenuItemsHtml($children, $level=0, $max_level=2) | |||
| 87 | { | 87 | { | |||
| 88 | $html = ''; | 88 | $html = ''; | |||
| 89 | if(count($children) && ($level < $max_level)){ | 89 | if(count($children) && ($level < $max_level)){ | |||
| 90 | $html .= '<ul'; | 90 | $html .= '<ul'; | |||
| 91 | if($level == 0) | 91 | if($level == 0) | |||
| 92 | $html .=' class="columns5"'; | 92 | $html .=' class="columns5"'; | |||
| 93 | $html .= '>'; | 93 | $html .= '>'; | |||
| 94 | foreach($children as $child) { | 94 | foreach($children as $child) { | |||
| 95 | $html .= '<li class="menu-item level'.$level; | 95 | $html .= '<li class="menu-item level'.$level; | |||
| 96 | $activeChildren = $this->getActiveChildCategories($child); | 96 | $activeChildren = $this->getActiveChildCategories($child); | |||
| 97 | 97 | |||||
| 98 | if(count($activeChildren)) | 98 | if(count($activeChildren)) | |||
| 99 | $html .= ' menu-parent-item'; | 99 | $html .= ' menu-parent-item'; | |||
| 100 | $html .= '">'; | 100 | $html .= '">'; | |||
| 101 | 101 | |||||
| 102 | $html .='<a href="'.$child->getUrl().'" data-id="'.$child->getId().'"><span>'.$child->getName().'</span></a>'; | 102 | $html .='<a href="'.$child->getUrl().'" data-id="'.$child->getId().'"><span>'.$child->getName().'</span></a>'; | |||
| 103 | if(count($activeChildren)) | 103 | if(count($activeChildren)) | |||
| 104 | $html .= $this->getSubmenuItemsHtml($activeChildren, $level+1, $max_level); | 104 | $html .= $this->getSubmenuItemsHtml($activeChildren, $level+1, $max_level); | |||
| 105 | $html .= '</li>'; | 105 | $html .= '</li>'; | |||
| 106 | } | 106 | } | |||
| 107 | $html .= '</ul>'; | 107 | $html .= '</ul>'; | |||
| 108 | } | 108 | } | |||
| 109 | return $html; | 109 | return $html; | |||
| 110 | } | 110 | } | |||
| 111 | } | 111 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.